package com.ruoyi.app.zzq.service.impl;

import com.ruoyi.app.zzq.domain.Usermigrate;
import com.ruoyi.app.zzq.mapper.OrgMapper;
import com.ruoyi.app.zzq.service.OrgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Service
public class OrgServiceImpl implements OrgService {
    @Autowired
    OrgMapper orgMapper;
    @Override
    public int SubmitTransferBranch(String id, String outpId, String inpId, String filePath, String reason) {
        //获取当前时间
        SimpleDateFormat formatter= new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
        Date date = new Date(System.currentTimeMillis());
        //获取
        return orgMapper.SubmitTransferBranch( id,  outpId,  inpId,  filePath,  reason,date);
    }

    @Override
    public List<Usermigrate> ServerTransferBranch(String id) {
        return orgMapper.ServerTransferBranch( id);
    }

    @Override
    public int IsTransferBranch(String flag,String userid) {
        if(flag.equals("0"))
        {
            return 0;
        }else

        return orgMapper.IsTransferBranch( flag,userid);
    }
}
